package com.company;

import java.util.Arrays;
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;

/**
 * @author Administrator
 */
public class HJ2计算某字母出现次数 {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String Strings = scanner.nextLine();
        String[] strings = Strings.split("");
        String nextSring = scanner.next();
        List<String> collect = Arrays.stream(strings).collect(Collectors.toList());
        long count = collect.stream().filter(t -> t.equalsIgnoreCase(nextSring)).count();
        System.out.println(count);
    }
}
